<template>
	<view class="page">
		<view class="flex benben-position-layout flex flex-wrap align-center chapterSelection_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub chapterSelection_fd0_0'>
				<view class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
					<text class='fu-iconfont2  chapterSelection_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<text class='chapterSelection_fd0_0_c1'>选择章节</text>
				<view class='flex flex-wrap align-center chapterSelection_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---flex布局flex布局开始-->
		<view class="flex benben-flex-layout flex-wrap align-center">
			<view class='flex flex-wrap align-center chapterExamination_fd1_0'>
				<image class='chapterExamination_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"30.png"'></image>
				<text class='chapterExamination_fd1_0_c1'>{{name}}</text>
			</view>
			<template v-for='(item,key0) in dataList'>
				<view class="flex not an flex align-center chapterSelection_notAnfd1_0_c0" @tap.stop="isChange(key0)">
				
					<view class='flex flex align-center justify-center flex-sub'>
						<image class='chapterSelection_notAnfd1_0_c0_c0_c0' mode="aspectFit"
							:src='STATIC_URL+"77.png"' v-if="!item.isOpen"></image>
						<image class='chapterSelection_notAnfd1_0_c0_c0_c0' mode="aspectFit"
							:src='STATIC_URL+"22.png"' v-else></image>	
						<text
							class='flex-sub chapterSelection_notAnfd1_0_c0_c0_c1'>{{item.chapter_name}}</text>
					</view>
				</view>
				
				<view class="flex area flex chapterSelection_areafd1_0_c0" v-if="item.isOpen">
				
					<view
						class='flex flex-direction align-stretch flex-sub flex chapterSelection_areafd1_0_c0_c0'>
						<view class='flex flex-direction flex-wrap align-stretch chapterSelection_areafd1_0_c0_c0_x'>
							<view
								class='flex flex-wrap align-center chapterSelection_areafd1_0_c0_c0_c0_c0'>
								<view class='flex flex-direction flex-wrap align-stretch flex-sub'>
									<view class='flex flex-wrap align-center'>
										<text
											class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c0'>{{item.classroom_test_log_num}}</text>
										<text
											class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c1'>/</text>
										<text
											class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c2'>{{item.total_topic_num}}</text>
										<text
											class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c3'>题</text>
										<text style="margin-left: 24rpx;">{{item.ratio}}</text>
									</view>
								</view>
							</view>
							<view class='flex benben-progress-bar chapterSelection_areafd1_0_c0_c0_c0_c1'>
								<u-line-progress inactive-color="#f2f2f2" active-color="#1593ff" height="16" :percent="(item.classroom_test_log_num / item.total_topic_num)*100"></u-line-progress>
							</view>
						</view>
						
						<view class='flex flex-direction flex-wrap align-stretch chapterSelection_areafd1_0_c0_c0_x' v-for="(v, k) in item.section_list" :key="k">
							<view @tap.stop="handleJumpDiy" data-type="navigateTo"
											:data-url="`/pages/my/skimmingChapter/recordDetails?section_id=${v.sectionmanage_id}&type=${type}`"
								class='flex flex-wrap align-center chapterSelection_areafd1_0_c0_c0_c0_c0'>
								<view class='flex flex-direction flex-wrap align-stretch flex-sub'>
									<view
										class='flex flex-wrap align-center chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c0'>
										<text
											class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c0_c0'>{{v.section_name}}</text>
									</view>
									<view class='flex flex-wrap align-center'>
										<block v-if="type == 1 || type == 2">
											<text
												class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c0'>{{v.simulation_test_log_num}}</text>
										</block>
										<block v-if="type == 3">
											<text
												class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c0'>{{v.classroom_test_log_num}}</text>
										</block>
										
										<text
											class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c1'>/</text>
										<text
											class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c2'>{{v.total_topic_num}}</text>
										<text
											class='chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c3'>题</text>
										<text style="margin-left: 24rpx;">{{v.ratio}}</text>
									</view>
								</view>
								<text
									class='fu-iconfont2  skimmingChapter_areafd1_0_c1_c0_c0_c0_c1'>&#xe7f2;</text>
								<!-- <button class='chapterSelection_areafd1_0_c0_c0_c0_c0_c1'
									@tap.stop="handleJumpDiy" data-type="navigateTo"
									:data-url="`/pages/index/accountingOverview/accountingOverview?section_id=${v.section_id}`">练习</button> -->
							</view>
							<view class='flex benben-progress-bar chapterSelection_areafd1_0_c0_c0_c0_c1' v-if="type == 1 || type == 2">
								<u-line-progress inactive-color="#f2f2f2" active-color="#1593ff" height="16" :percent="(v.simulation_test_log_num / v.total_topic_num)*100"></u-line-progress>
				
							</view>
							<view class='flex benben-progress-bar chapterSelection_areafd1_0_c0_c0_c0_c1' v-if="type == 3">
								<u-line-progress inactive-color="#f2f2f2" active-color="#1593ff" height="16" :percent="(v.classroom_test_log_num / v.total_topic_num)*100"></u-line-progress>
											
							</view>
						</view>
					</view>
				
				</view>
				
			</template>
		</view>
		<!---flex布局flex布局结束-->
		<view class="flex flex-wrap align-center justify-center benben-flex-layout" v-if="dataList.length=='0'">
			<benben-empty>
				<view class='flex flex-direction flex-wrap align-center examinationRecords_fd2_0'>
					<image class='examinationRecords_fd2_0_c0' mode="widthFix" :src='STATIC_URL+"76.png"'></image>
					<text class='examinationRecords_fd2_0_c1'>暂无数据</text>
		
				</view>
			</benben-empty>
		</view>

	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},

		data() {
			return {
				"dataList": [],
				"aid": "",
				"type": '',
				"name": ''
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			let {
				aid,
				type,
				name
			} = options
			this.aid = aid || '';
			this.type = type || '';
			this.name = name || '';
			this.getdataList()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//获取章节列表
			async getdataList() {
				//请求方法
				//数据验证
				let url = "";
				if (this.type == 2) {
					url = global.apiUrls.post6309952bd200f;
				} else {
					url = global.apiUrls.post6309957a297f6;
				}
				let dataListData = await this.$api.post(url, {
					subjectmanage_id: this.aid
				});
				if (dataListData.data.code != 1) {
					this.$message.info(dataListData.data.msg);
					return
				}
				let dataListinfo = dataListData.data;
				this.dataList = dataListinfo.data;
				if (this.dataList.length > 0) {
					this.dataList.forEach((v, k) => {
						v.isOpen = false;
					})
				}
				console.log(this.dataList);
			},
			isChange(k) {
				this.dataList[k].isOpen = !this.dataList[k].isOpen;
				this.$forceUpdate();
			}
		}
	};
</script>
<style lang="scss" scoped>
	/deep/.u-progress {
		display: block !important;
	}
	.skimmingChapter_areafd1_0_c1_c0_c0_c0_c1 {
		font-size: 26rpx;
		color: #999;
		transform: translateY(20rpx);
	}
	.chapterExamination_fd1_0 {
		margin: 0rpx 16rpx 0rpx 0rpx;
		padding: 40rpx 32rpx 24rpx 32rpx;
	}
	
	.chapterExamination_fd1_0_c0 {
		width: 36rpx;
		height: 36rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}
	
	.chapterExamination_fd1_0_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 700;
		color: #333333;
	}
	
	.chapterSelection_notAnfd1_0_c0 {
		background: rgba(244, 250, 255, 1);
		background-size: 100% !important;
		width: 750rpx;
		height: 80rpx;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
		margin-bottom: 24rpx;
	}

	.chapterSelection_anfd1_0_c0 {
		background: rgba(244, 250, 255, 1);
		background-size: 100% !important;
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
		width: 750rpx;
		height: 80rpx;
	}

	.chapterSelection_areafd1_0_c0 {
		width: 100%;
		min-height: 80rpx;
		padding: 0rpx 32rpx 0rpx 32rpx;
		margin-bottom: 28rpx;
	}

	.chapterSelection_notAnfd1_0_c0_c0_c0 {
		width: 36rpx;
		height: 36rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.chapterSelection_notAnfd1_0_c0_c0_c1 {
		font-weight: 700;
		font-size: 32rpx;
		color: #1593FF;
		line-height: 45rpx;
		text-decoration: none;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.chapterSelection_anfd1_0_c0_c0_c0 {
		width: 36rpx;
		height: 36rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.chapterSelection_anfd1_0_c0_c0_c1 {
		font-weight: 700;
		font-size: 32rpx;
		color: #1593FF;
		line-height: 45rpx;
		text-decoration: none;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.chapterSelection_areafd1_0_c0_c0 {
		// border-bottom: 1px solid #eee;
		// padding: 32rpx 0rpx 40rpx 0rpx;
	}
	.chapterSelection_areafd1_0_c0_c0_x {
		padding-top: 24rpx;
		padding-bottom: 24rpx;
		border-bottom: 1rpx solid #eee;
	}

	.chapterSelection_areafd1_0_c0_c0_c0_c0 {
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c0 {
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c0_c0 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c0 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(21, 147, 255, 1);
	}

	.chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c1 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c2 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.chapterSelection_areafd1_0_c0_c0_c0_c0_c0_c1_c3 {
		line-height: 40rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.chapterSelection_areafd1_0_c0_c0_c0_c0_c1 {
		background: rgba(21, 147, 255, 1);
		background-size: 100% !important;
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 26rpx;
		color: #fff;
		margin: 0rpx 0rpx 0rpx auto;
		width: 140rpx;
		height: 56rpx;
		line-height: 56rpx;
	}

	.chapterSelection_areafd1_0_c0_c0_c0_c1 {
		background: rgba(242, 242, 242, 1);
		background-size: 100% !important;
		width: 602rpx;
		height: 16rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
	}
	/deep/.u-active {
		color: transparent !important;
	}
	.chapterSelection_progress1_areafd1_0_c0_c0_c0_c1 {
		background: rgba(21, 147, 255, 1);
		background-size: 100% !important;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
	}

	.chapterSelection_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
	}

	.chapterSelection_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
		line-height: 36rpx;
	}

	.chapterSelection_fd0_0_c1 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.chapterSelection_fd0_0_c2 {
		width: 36rpx;
		height: 36rpx;
	}

	.chapterSelection_flex_0 {
		background: #fff;
		background-size: 100% !important;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.page {
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto !important;
	}
</style>
